using System.Collections.Generic;
using UnityEngine;

public class GotchaDev : MonoBehaviour
{
	public UIScrollView logScrollView;

	public UIGrid logGrid;

	public UILabel logMessageObj;

	private List<UILabel> rewardLog = new List<UILabel>();

	public void ShowDevWindow()
	{
		if (GotchaManager.instance == null)
		{
			Debug.LogError("GotchaManager.instance == null");
		}
		else
		{
			base.gameObject.SetActive(true);
		}
	}

	public void CloseDevWindow()
	{
		base.gameObject.SetActive(false);
		if (GotchaShowButton.instance != null)
		{
			GotchaShowButton.instance.SetUI();
		}
	}

	public void Log(string message, Color color)
	{
		UILabel uILabel = Object.Instantiate(logMessageObj);
		uILabel.transform.SetParent(logGrid.transform);
		uILabel.transform.localScale = Vector3.one;
		uILabel.text = message;
		uILabel.color = color;
		uILabel.gameObject.SetActive(true);
		logGrid.repositionNow = true;
		rewardLog.Add(uILabel);
	}

	public void ClearLog()
	{
		for (int i = 0; i < rewardLog.Count; i++)
		{
			Object.Destroy(rewardLog[i].gameObject);
		}
		rewardLog.Clear();
		logScrollView.ResetPosition();
	}
}
